import { get, post, put, deleteReq } from '@/utils/request';
// 查询角色列表
export function listRole(query: any) {
    return get({
        url: '/api/v1/role',
        data: query,
    });
}

// 查询角色详细
export function getRole(roleId: string) {
    return get({
        url: '/api/v1/role/' + roleId,
    });
}

// 新增角色
export function addRole(data: any) {
    return post({
        url: '/api/v1/role',
        data: data,
    });
}

// 修改角色
export function updateRole(data: any, roleId: string) {
    return put({
        url: '/api/v1/role/' + roleId,
        data: data,
    });
}

// 角色数据权限
export function dataScope(data: any) {
    return put({
        url: '/api/v1/roledatascope',
        data: data,
    });
}

// 角色状态修改
export function changeRoleStatus(roleId: string, status: string) {
    const data = {
        roleId,
        status,
    };
    return put({
        url: '/api/v1/role-status',
        data: data,
    });
}

// 删除角色
export function delRole(roleId: string) {
    return deleteReq({
        url: '/api/v1/role',
        data: roleId,
    });
}

export function getListrole(id: string) {
    return get({
        url: '/api/v1/menu/role/' + id,
    });
}

export function getRoutes() {
    return get({
        url: '/api/v1/menurole',
    });
}
